#ifndef TASKPACKNODEITEM_H
#define TASKPACKNODEITEM_H
#include "SelectController.h"
#include <QGraphicsRectItem>
#include <QObject>

class TaskPackNodeItem : public QObject, public QGraphicsRectItem
{
    Q_OBJECT
public:
    TaskPackNodeItem();
    SelectAdapter* selectAdapter() ;

private slots:
    void sendGeometry();
    void handleSatelliteClicked(SatellitePosition p);
    void appendChildNode();
    void appendSiblingNode();
    void receiveSelectToken();

protected:
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
    void focusInEvent(QFocusEvent *event);

private:
    SelectAdapter _select_adapter;
};

class AppendChildNodeSatelliteItem : public QObject, public QGraphicsEllipseItem
{
    Q_OBJECT
public:
    AppendChildNodeSatelliteItem();
    SatelliteAdapter* satelliteAdapter() ;

private slots:
    void adjustGeometry(QRectF geometry);
    void invisible(bool yes);

protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
    QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

private:
    SatelliteAdapter _satellite_adapter;
    bool ignore_once = false;
};

#endif // TASKPACKNODEITEM_H
